#include "sdk.h"
#include "personalitymanager.h"
#include "manager.h"
#include "configmanager.h"
#include <wx/intl.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/arrstr.h>

template<> PersonalityManager* Mgr<PersonalityManager>::instance = nullptr;
template<> bool  Mgr<PersonalityManager>::isShutdown = false;
wxString PersonalityManager::pers;

PersonalityManager::PersonalityManager() {
  PersonalityManager::pers = _T( "default" );
}

void PersonalityManager::SetPersonality( const wxString& personality, M_Code_unused bool createIfNotExist ) {
  pers = personality;
}

const wxString PersonalityManager::GetPersonality() {
  return pers;
}

const wxArrayString PersonalityManager::GetPersonalitiesList() {
  wxArrayString list;
  wxDir::GetAllFiles( ConfigManager::GetConfigFolder(), &list, _T( "*.conf" ), wxDIR_FILES );
  for( size_t i = 0; i < list.GetCount(); ++i ) {
    list[i] = wxFileName( list[i] ).GetName();
  }
  return list;
}
